﻿using System;
using JinianNet.JNCms.Models;
using System.Collections.Generic;

namespace JinianNet.JNCms.Data
{
    public interface IAttachment
    {
        /// <summary>
        /// 添加
        /// </summary>
        int Insert(Attachment model);
        /// <summary>
        /// 修改附件所属类型与关联ID
        /// </summary>
        int Update(int value, int typeId, string[] ids);
        /// <summary>
        /// 删除
        /// </summary>
        int Delete(int value, int typeId);
        /// <summary>
        /// 根据关联ID与类型取所有附件
        /// </summary>
        List<Attachment> GetListByItem(int value, int typeId);
        /// <summary>
        /// 分页取所有附件
        /// </summary>
        List<Attachment> GetList(int pageIndex, int pageSize);
        /// <summary>
        /// 根据附件编号获取详情
        /// </summary>
        Attachment GetItem(int id);
        /// <summary>
        /// 根据ID删除数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int Delete(int id);
    }
    public partial class DataAccess
    {
        public static IAttachment CreateAttachment()
        {
            return (IAttachment)CreateObject(".Attachment");
        }
    }
}
